<template>
  <div class="insurances-list">
    <el-table border :data="tableData" style="width: 100%">
      <el-table-column prop="date" label="Date" width="180" />
      <el-table-column prop="name" label="Name" width="180" />
      <el-table-column prop="address" label="Address" />
    </el-table>
    <el-pagination background layout="total, sizes, prev, pager, next" :total="total" />
  </div>
</template>

<script lang="ts" setup>
import { onMounted, ref } from 'vue';
import { insurances } from '../api/base';

const tableData = ref<any[]>([]);
const total = ref(0);

const getTableData = async () => {
  const { data } = await insurances({ page: 1, limit: 10 });
  tableData.value = data.list;
  total.value = data.totalCount;
};

onMounted(() => {
  getTableData();
});
</script>

<style lang="scss" scoped>
.insurances-list {
  .el-pagination {
    margin-top: 10px;
  }
}
</style>
